import request from './request'

/**
 * Sperm vial related API
 */
export const vialAPI = {
  /**
   * Get vial list
   */
  getList(params) {
    return request({
      url: '/vials',
      method: 'get',
      params
    })
  },

  /**
   * Get vial details
   */
  getDetail(id) {
    return request({
      url: `/vials/${id}`,
      method: 'get'
    })
  },

  /**
   * Create vial
   */
  create(data) {
    return request({
      url: '/vials',
      method: 'post',
      data
    })
  },

  /**
   * Update vial
   */
  update(id, data) {
    return request({
      url: `/vials/${id}`,
      method: 'put',
      data
    })
  },

  /**
   * Delete vial
   */
  delete(id) {
    return request({
      url: `/vials/${id}`,
      method: 'delete'
    })
  },

  /**
   * Get available vials (for creating orders)
   */
  getAvailable(params) {
    return request({
      url: '/vials/available',
      method: 'get',
      params
    })
  }
}
